<%@ page contentType="text/html;charset=UTF-8"%>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
	<title>创建报价单</title>
    <%@ include file="/WEB-INF/views/include/head.jsp"%>
    <script src="${ctxStatic}/js/jquery-1.9.1.min.js"></script>
    <script src="${ctxStatic}/js/DateTimePicker.js"></script>
    <script src="${ctxStatic}/js/layer.js"></script>
    <script src="${ctxStatic}/js/style.js"></script>
    <script src="${ctxStatic}/dateCalendar/WdatePicker.js"></script>
    <link rel="stylesheet" href="${ctxStatic}/css/common.css">
    <link rel="stylesheet" href="${ctxStatic}/css/layerSm.css">
    <script>
    $(function(){
            $(".tabBox ul li").each(function(){
                var index=$(this).index();

                $(".tabBox ul li").eq(0).addClass("active");

                $(this).click(function(){

                    //alert(index);

                    $(this).addClass("active").siblings().removeClass("active");

                    $(".tabBoxSm > .tabSm").eq(index).stop(true).show().siblings().stop(true).hide();
					
					var tableW = $(".tabBoxSm > .tabSm").eq(index).find('.tableHead').width();
					var tabodyH = $(".tabBoxSm > .tabSm").eq(index).find('.tableBody').height();
					var tableScrollH = $(".tabBoxSm > .tabSm").eq(index).find('.tableScroll').height();
					if(tabodyH>tableScrollH){
						$(".tabBoxSm > .tabSm").eq(index).find('.tableScroll').css('width',tableW + 18 + 'px')
					}else{
						$(".tabBoxSm > .tabSm").eq(index).find('.tableScroll').css('width','inherit')
					}

                })

            })

        })
        
        $(document).ready(function(){
        	if ($("#id").val() == null || $("#id").val() == 0) {
        		$("#contractStatus").attr('disabled','disabled');
			}
        	if ($("#ognizationNameB").val() != null && $("#ognizationNameB").val() != '') {
        		showBtn();
			}
        	$("#paymentWay").select2();
        	$("#contractStatus").select2();
        	var form = $("#inputForm");  
            form.validate();//验证指定的表单
       		$("#okButton").click(function(){
        		if (form.valid()) {//如果表单验证成功，则进行提交。  
        		$("#showHtml").addClass("showHtml");
                $("#okHead").show();
                $("#createHead").hide();  
                $("#paymentWay").attr('disabled','disabled');
                $("#contractDateTime").removeClass("laydate-icon");
                $("#contractDeliveryDate").removeClass("laydate-icon");
                return false;
              	}
         	});
        });
    /* 删除   */
	 
	 function deleteCurrentRow(obj){ 
		 
		 if (confirm("<spring:message code="puttingContract_edit_areYouSureDelete"/>")) {
         var tr=obj.parentNode.parentNode;  
         var tbody=tr.parentNode 
         tbody.removeChild(tr);
         quantity();
         amount();
		}
	 }
    function showBtn() {
		$("#createStyle").show();
	}
    
    function styleWin() {
    	//var styleCustomerName = $("#ognizationNameB").val();
    	popup('900px','584px','${ctx}/quotation/message/createStyle?frameFlg=5');
	}
    //添加款式 
    function selectStyle(styleId,indentID,contractID,styleCustomerNo,styleNameCN,styleFile,styleCatgoryCN,styleCustomerName,customerContractNO,indentQuantity,creatorName,createDate) {
    		var statusIndex = getIndex();
    		
    		var html = "";
    		var idHtml = "";
    		var index = parseInt(statusIndex)+parseInt(1);
    		idHtml += "<input type='hidden' name='styleList["+index+"].contractID' value='"+contractID+"'/>";
    		idHtml += "<input type='hidden' name='styleList["+index+"].styleID' value='"+styleId+"'/>";
    		idHtml += "<input type='hidden' name='styleList["+index+"].indentID' value='"+indentID+"'/>";
    		idHtml += "<input type='hidden' class='statusIndex' value='"+index+"'/>";
    		
    		html += "<tr>";
    		html += "<td class='tab-wfcz'><img src='${ctxStatic}/images/btn-sc.png' style='width: 25px' onclick='deleteCurrentRow(this);'></td>";
    		html += "<td><img class='tab-wfkstp' src='"+styleFile+"'></td>";
    		html += "<td class='tab-wfkhksmc'>"+styleCustomerNo+"<br>"+styleNameCN+"</td>";
    		html += "<td class='tab-wfkslb'>"+styleCatgoryCN+"</td>";
    		html += "<td class='tab-wfhtddh'>"+customerContractNO+"</td>";
    		html += "<td class='tab-wfkh'>"+styleCustomerName+"</td>";
    		html += "<td class='tab-wfddsl'>"+indentQuantity+"</td>";
    		html += "<td class='tab-wfsl'><input id='puttingQuantity' name='styleList["+index+"].contractQuantity' value='' onchange='quantity();' style='height:65px'></td>";
    		html += "<td class='tab-wfjgf'><input id='puttingPrice' name='styleList["+index+"].contractProcessCost'  value='' onchange='amount();' style='height:65px'></td>";
    		html += "<td class='tab-wfcjr'>"+creatorName+"</td>";
    		html += "<td class='tab-wfcjsj'>"+createDate+"</td>";
    		html += idHtml;
    		html += "</tr>";
    		$("#listHtml").append(html);
	}
    /* 获取最大下标 */
    function getIndex() {
    	var statusList = $(".statusIndex").length;
    	var statusNum = 0;
    	if (statusList!=0) {
    		statusNum = $("tbody#listHtml").find("input.statusIndex")[statusList-1].value;
		}
    	return statusNum;
	}
  //计算加工数量 
	 function quantity(){
		 var length = $("tbody tr").length;
		 var sum = 0;
		 for (var i = 0; i < length; i++) {
			 var puttingQuantity = $("tbody tr").find("input#puttingQuantity")[i].value;
			 if (puttingQuantity==null||puttingQuantity=='') {
				 puttingQuantity = 0;
			}
			 sum += parseFloat(puttingQuantity);
		 }
		 $("#contractMaterialQuantity").val(sum);
		 
	 }
  
	//计算加工金额  
	 function amount(){
		 var length = $("tbody tr").length;
		 var sum = 0;
		 for (var i = 0; i < length; i++) {
			 var puttingPrice = $("tbody tr").find("input#puttingPrice")[i].value;
			 if (puttingPrice==null||puttingPrice=='') {
				 puttingPrice = 0;
			}
			 sum += parseFloat(puttingPrice);
		 }
		 $("#contractAmount").val(sum);
		 
	 }
	
	 /* 保存创建/编辑信息 */
	    function saveForm(){
	    	$("#contractStatus").removeAttr("disabled");
	    	$("#paymentWay").removeAttr("disabled");
	    	var params = $("#inputForm").serialize();
	    	$.post("${ctx}/putting/contract/save",params,function(result){
	    		/* 弹出提示框,刷新父页面,关闭当前页面 */
	    		tipParent(result.message);
	    		 window.parent.frames[0].searchListForm();
	    		closeWin();
	    	},'json');
	    	
	    }
	 
	    /* 修改合同条款  */
	    function updateClause(){
	    	var paymentWayText = $("#paymentWayText").val();
	    	var paymentWay = $("#paymentWay").val();
	    	var paymentWayB = "<spring:message code="puttingContract_edit_paymentWayB" />";
	    	if (paymentWay!="") {
	    		var wayHtml = $("#paymentWay").find("option:selected").text();
	    		var clauseHtml = $("#contractClause").html();
	    		if (paymentWayText!=null && paymentWayText!="") {
	    			clauseHtml = clauseHtml.replace(paymentWayText,wayHtml);
	    			$("#contractClause").html(clauseHtml);
	    			$("#paymentWayText").val(wayHtml);
				}else{
	    			clauseHtml = clauseHtml.replace(paymentWayB,wayHtml);
	    			$("#contractClause").html(clauseHtml);
	    			$("#paymentWayText").val(wayHtml);
				}
			}
	    }
    </script>
    <style type="text/css">
    							.tab-wfcz{width: 40px;}
    							.tab-wfkstp{width: 65px;}
		                        .tab-wfkhksmc{width: 100px;}
		                        .tab-wfkslb{width: 80px;}
		                        .tab-wfhtddh{width: 100px;}
		                        .tab-wfkh{width: 120px;}
		                        .tab-wfddsl{width: 80px;}
		                        .tab-wfsl{width: 100px;}
		                        .tab-wfjgf{width: 100px;}
		                        .tab-wfcjr{width: 80px;}
		                        .tab-wfcjsj{width: 100px;}
   
    .w-650{
	width:650px;
	}
	.w-65{
	width:65px;
	}
	.showHtml input{
	border:none;
	background-color:inherit;
	color:#333;
	}
    </style>
</head>
<body>
<form id="inputForm">
<!-- 创建编辑头部 -->   
<div id="createHead" class="layerHeader clearfix">
<c:choose>
	   <c:when test="${puttingContract.id!=null && puttingContract.id!=0}">
	    <!-- 编辑 --> 
			<p class="headerTitle"><spring:message code="puttingContract_edit_editContract"/></p>
       </c:when>
       <c:otherwise>
        <!-- 创建 --> 
            <p class="headerTitle"><spring:message code="puttingContract_edit_createContract"/></p>
       </c:otherwise>
    </c:choose>
	
    <div class="headerButton clearfix">
        <button id="createStyle" type="button" style="display: none;" onclick="styleWin();"><spring:message code="puttingContract_edit_addStyle"/></button>
        <button type="button" id="okButton"><spring:message code="puttingContract_edit_ok"/></button>
        <button type="button" onclick="closeWin()"><spring:message code="puttingContract_edit_cancle"/></button>
    </div>
</div>
<!-- 确认画面头部 -->
<div id="okHead" class="layerHeader clearfix" style="display: none;">	      
             <p class="headerTitle"><spring:message code="puttingContract_edit_Ok" /></p>    
    <div class="headerButton clearfix">
    <c:choose>
	   <c:when test="${puttingContract.id!=null && puttingContract.id!=0}">
	    <!-- 编辑 保存 --> 
	    <shiro:hasPermission name="quotation:message:edit">
			<button type="button" onclick="saveForm();"><spring:message code="common_save" /></button>
		</shiro:hasPermission>
       </c:when>
       <c:otherwise>
        <!-- 创建 保存 --> 
        <shiro:hasPermission name="quotation:message:edit">
            <button type="button" onclick="saveForm();"><spring:message code="common_save" /></button>
            </shiro:hasPermission>
       </c:otherwise>
     </c:choose>
        <!-- 取消 -->
          <button type="button" onclick="closeWin()"><spring:message code="quotation_create_cancle"/></button>
    </div>
</div>
<div class="tabBox">
    <ul class="clearfix">
     	<li class="active" style="width: 100px"><spring:message code="puttingContract_edit_contractMessage"/></li>
        <li style="width: 110px"><spring:message code="puttingContract_edit_styleList"/></li>
    </ul>
    
</div>
<div id="showHtml" class="tabBoxSm">
   <input type="hidden" id="id" name="id" value="${puttingContract.id }">
   <input type="hidden" id="contractProcessNO" name="contractProcessNO" value="${puttingContract.contractProcessNO }">
    <div class="tabSm smOrderBox">
        <div class="items clearfix">
             <div class="col-50 clearfix ">
             <!-- 甲方公司  -->
                <p class="tit"><spring:message code="puttingContract_edit_companyA"/></p>
                <c:choose>
                <c:when test="${puttingContract.id!=null&&puttingContract.id!=0 }">
                <input type="hidden" id="ognizationIDA" name="ognizationIDA" value="${puttingContract.ognizationIDA }">
                	<div class="showHtml"><input id="" name="" value="${puttingContract.ognizationNameA }" style="width: 315px"></div>
                </c:when>
                <c:otherwise>
                <input type="hidden" id="ognizationIDA" name="ognizationIDA" value="${ognization.id }">
                	<div class="showHtml"><input id="" name="" value="${ognization.ognizationName }" style="width: 315px"></div>
                </c:otherwise>
                </c:choose>
                
            </div>
            <div class="col-50 clearfix haveToBox">
            <!-- 乙方公司   -->
                <p class="tit"><spring:message code="puttingContract_edit_companyB"/></p>
                 <input type="hidden" id="ognizationIDB" name="ognizationIDB" value="${puttingContract.ognizationIDB }">
                <input type="hidden" id="ognizationShortNameB" name="ognizationShortNameB" value="">
                <input id="ognizationNameB" name="ognizationNameB"   value="${puttingContract.ognizationNameB }" style="width: 315px" readonly="readonly" data-rule-required="true" data-msg-required="<spring:message code="puttingContract_error_msg_ognizationNameB"/>">
                <button type="button" onclick="popup('900px','584px','${ctx}/purchase/contract/ognizationList?ognizationFlag=3&frameFlg=1')"><spring:message code="puttingContract_edit_select"/></button>
                <p class="haveTo">*</p>
            </div>
        </div>
        <div class="items clearfix">
            <div class="col-50 clearfix  showHtml">
            <!-- 住所地  -->
                <p class="tit"><spring:message code="puttingContract_edit_address"/></p>
                <c:choose>
                <c:when test="${puttingContract.id!=null&&puttingContract.id!=0 }">
                	<input id="" name=""  value="${puttingContract.ognizationAddressA }" style="width: 315px">
                </c:when>
                <c:otherwise>
                	<input id="" name=""  value="${ognization.ognizationAddress }" style="width: 315px">	
                </c:otherwise>
                </c:choose>
            </div>
            <div class="col-50 clearfix">
            <!-- 住所地  -->
                <p class="tit"><spring:message code="puttingContract_edit_address"/></p>
                <input id="ognizationAddressB" name="ognizationAddressB"  value="${puttingContract.ognizationAddressB }" readonly="readonly" style="width: 315px">
                
            </div>
        </div>
        <div class="items clearfix">
            <div class="col-50 clearfix">
          		<div class="left clearfix showHtml">
          		<!-- 法人代表  -->
                	<p class="tit"><spring:message code="puttingContract_edit_legalPerson"/></p>
                <c:choose>
                <c:when test="${puttingContract.id!=null&&puttingContract.id!=0 }">
                	<input id="" name="" value="${puttingContract.legalPersonA }" style="width: 110px">
                </c:when>
                <c:otherwise>
                	<input id="" name="" value="${ognization.legalPerson }" style="width: 110px">	
                </c:otherwise>
                </c:choose>
            	</div>
            	<div class="right clearfix haveToBox" style="margin-right: 100px;">
            	<!-- 主联系人  -->
                	<p class="tit"><spring:message code="puttingContract_edit_contactPerson"/></p>
                <c:choose>
                <c:when test="${puttingContract.id!=null&&puttingContract.id!=0 }">
                	<input id="contactPersonA" name="contactPersonA"  value="${puttingContract.contactPersonA }" style="width: 110px" data-rule-required="true" data-msg-required="<spring:message code="puttingContract_error_msg_contactPersonA"/>">
                </c:when>
                <c:otherwise>
                	<input id="contactPersonA" name="contactPersonA"  value="${ognization.contactPerson }" style="width: 110px" data-rule-required="true" data-msg-required="<spring:message code="puttingContract_error_msg_contactPersonA"/>">
                </c:otherwise>
                </c:choose>
                <p class="haveTo">*</p>
            	</div>
            </div>
            <div class="col-50 clearfix">
            	<div class="left clearfix">
            	<!-- 法人代表  -->
                	<p class="tit"><spring:message code="puttingContract_edit_legalPerson"/></p>
                	<input id="legalPersonB" name="legalPersonB"  value="${puttingContract.legalPersonB }" readonly="readonly" style="width: 110px">
            	</div>
            	<div class="right clearfix haveToBox" style="margin-right: 100px;">
            	<!-- 主联系人  -->
                	<p class="tit"><spring:message code="puttingContract_edit_contactPerson"/></p>
               		<input id="contactPersonB" name="contactPersonB"  value="${puttingContract.contactPersonB }" style="width: 110px" data-rule-required="true" data-msg-required="<spring:message code="puttingContract_error_msg_contactPersonB"/>">
               		<p class="haveTo">*</p>
            	</div>
            </div>
        </div>
        <div class="items clearfix">
            <div class="col-50 clearfix showHtml">
            	<div class="left clearfix">
            	<!-- 联系电话  -->
                	<p class="tit"><spring:message code="puttingContract_edit_contactPhone"/></p>
                <c:choose>
                <c:when test="${puttingContract.id!=null&&puttingContract.id!=0 }">
                	<input id="" name=""  value="${puttingContract.contactPhoneA }" style="width: 110px">
                </c:when>
                <c:otherwise>
                	<input id="" name=""  value="${ognization.contactPhone}" style="width: 110px">
                </c:otherwise>
                </c:choose>
            	</div>
            	<div class="right clearfix" style="margin-right: 100px;">
            	<!-- 传真号码  -->
                	<p class="tit"><spring:message code="puttingContract_edit_contactFax"/></p>
               	<c:choose>
                <c:when test="${puttingContract.id!=null&&puttingContract.id!=0 }">
               		<input id="" name=""  value="${puttingContract.contactFaxA }" style="width: 110px">
                </c:when>
                <c:otherwise>
                	<input id="" name=""  value="${ognization.contactFax }" style="width: 110px">
                </c:otherwise>
                </c:choose>
            	</div>
            </div>
            <div class="col-50 clearfix">
            	<div class="left clearfix haveToBox">
            	<!-- 联系电话  -->
                	<p class="tit"><spring:message code="puttingContract_edit_contactPhone"/></p>
                	<input id="contactPhoneB" name="contactPhoneB"  value="${puttingContract.contactPhoneB }" style="width: 110px" data-rule-required="true" data-msg-required="<spring:message code="puttingContract_error_msg_contactPhoneB"/>">
                	<p class="haveTo">*</p>
            	</div>
            	<div class="right clearfix haveToBox" style="margin-right: 100px;">
            	<!-- 传真号码  -->
                	<p class="tit"><spring:message code="puttingContract_edit_contactFax"/></p>
               		<input id="contactFaxB" name="contactFaxB"  value="${puttingContract.contactFaxB }" style="width: 110px" data-rule-required="true" data-msg-required="<spring:message code="puttingContract_error_msg_contactFaxB"/>">
               		<p class="haveTo">*</p>
            	</div>
            </div>
        </div>
        <div class="items clearfix">
            <div class="col-50 clearfix showHtml">
            <!-- 电子邮箱  -->
                <p class="tit"><spring:message code="puttingContract_edit_contactEmail"/></p>
                <c:choose>
                <c:when test="${puttingContract.id!=null&&puttingContract.id!=0 }">
                	<input id="" name="" value="${puttingContract.contactEmailA }" style="width: 315px">
                </c:when>
                <c:otherwise>
                	<input id="" name="" value="${ognization.contactEmail }" style="width: 315px">	
                </c:otherwise>
                </c:choose>
            </div>
            <div class="col-50 clearfix haveToBox">
            <!-- 电子邮箱  -->
                <p class="tit"><spring:message code="puttingContract_edit_contactEmail"/></p>
                <input id="contactEmailB" name="contactEmailB"   value="${puttingContract.contactEmailB }" style="width: 315px" data-rule-required="true" data-msg-required="<spring:message code="puttingContract_error_msg_contactEmailB"/>">
                <p class="haveTo">*</p>
            </div>
        </div>
        <div class=" clearfix" >
        <!-- 外发合同基本信息  -->
        	<p class="title" style="margin-top: 2px"><spring:message code="puttingContract_edit_contractBasicMessage"/></p>
        </div>
        <div class="clearfix">
        	<div class="left w-650">
            	<div class="items clearfix">        	
                    <div class="col-50 clearfix haveToBox">
                    <!-- 付款方式  -->
                        <p class="tit" style="width: 80px"><spring:message code="puttingContract_edit_paymentWay"/></p>
                        <c:set value="QUOTATION_TYPE" var="typeList"/>
                        <select id="paymentWay" name="paymentWay" style="width: 150px" data-rule-required="true" data-msg-required="<spring:message code="puttingContract_error_msg_paymentWay"/>">
                            <option value=""><spring:message code="quotation_create_selectPlease"/></option>
                        <c:forEach items="${fns:getDictList(typeList) }" var="paymentWay">
                            <option   value="${paymentWay.itemCode}-${paymentWay.itemValue}" <c:if test="${fn:split(puttingContract.paymentWay,'-')[1] eq paymentWay.itemValue }">selected="selected"</c:if>>${paymentWay.itemName}</option>
                        </c:forEach>
                        </select>
                        <input type="hidden" id="paymentWayText"  value=""/>
                        <p class="haveTo">*</p>
                    </div>
                    <div class="col-50 clearfix haveToBox">
                    <!-- 合同状态  -->
                        <p class="tit" style="width: 80px"><spring:message code="puttingContract_edit_contractStatus"/></p>
                        <c:set value="CONTRACT_STAUS" var="statusList"/>
                        <select id="contractStatus" name="contractStatus" style="width: 150px" data-rule-required="true" data-msg-required="<spring:message code=""/>">
                        <c:forEach items="${fns:getDictList(statusList) }" var="status">
                            <option   value="${status.itemCode}-${status.itemValue}" <c:if test="${fn:split(puttingContract.contractStatus,'-')[1] eq status.itemValue }">selected="selected"</c:if>>${status.itemName}</option>
                        </c:forEach>
                        </select>
						<p class="haveTo">*</p>
                    </div>
                </div>
                <div class="items clearfix">        	
                    <div class="col-50 clearfix haveToBox">
                    <!-- 外发加工数量 -->
                        <p class="tit" style="width: 80px"><spring:message code="puttingContract_edit_contractQuantity"/></p>
                        <input id="contractMaterialQuantity" name="contractMaterialQuantity"  value="${puttingContract.contractMaterialQuantity }" data-rule-required="true" data-msg-required="<spring:message code="puttingContract_error_msg_contractMaterialQuantity"/>">
                        <p class="haveTo">*</p>
                    </div>
                    <div class="col-50 clearfix haveToBox">
                    <!-- 外发加工金额  -->
                        <p class="tit" style="width: 80px"><spring:message code="puttingContract_edit_contractAmount"/></p>
                        <input id="contractAmount" name="contractAmount"  value="${puttingContract.contractAmount }" data-rule-required="true" data-msg-required="<spring:message code="puttingContract_error_msg_contractAmount"/>">
                        <p class="haveTo">*</p>
                    </div>
                </div>
                <div class="items clearfix">        	
                    <div class="col-50 clearfix haveToBox">
                    <!-- 签订日期  -->
                        <p class="tit" style="width: 80px"><spring:message code="puttingContract_edit_contractDateTime"/></p>
                        <input type="text" onblur="CheckDate(this);" 
								id="contractDateTime" name="contractDateTime"  value="<fmt:formatDate value="${puttingContract.contractDateTime }" pattern="yyyy-MM-dd" />" data-rule-required="true" data-msg-required="<spring:message code="puttingContract_error_msg_contractDateTime"/>">
                        <p class="haveTo">*</p>
                    </div>
                    <div class="col-50 clearfix haveToBox">
                    <!-- 预计交货日期  -->
                        <p class="tit" style="width: 80px"><spring:message code="puttingContract_edit_contractEndDate"/></p>
                        <input type="text" onblur="CheckDate(this);" 
								id="contractDeliveryDate" name="contractDeliveryDate"  value="<fmt:formatDate value="${puttingContract.contractDeliveryDate }" pattern="yyyy-MM-dd" />" data-rule-required="true" data-msg-required="<spring:message code="puttingContract_error_msg_contractDeliveryDate"/>">
                        <p class="haveTo">*</p>
                    </div>
                </div>
            </div>
            <div class="w-330">
                <div class="items clearfix">     
                    <!-- 特殊说明  -->
                    <p class="tit"><spring:message code="puttingContract_edit_specialExplain"/></p>
                    <textarea id="specialExplain" name="specialExplain" style="width:220px;height: 105px">${puttingContract.specialExplain }</textarea>
                </div>
            </div>
        </div>
        <div class="items clearfix  haveToBox">        	
            <div class="left w-65 clearfix">
           <!-- 合同条款 -->
                <p class="tit"><spring:message code="puttingContract_edit_contractClause"/></p>
                <button type="button" onclick="popup('900px','584px','${ctx}/purchase/contract/selectClause')"><spring:message code="puttingContract_edit_select"/></button>
                </div>
                <div class="clearfix">
                <textarea id="contractClause" name="contractClause" style="width:870px;height: 140px" data-rule-required="true" data-msg-required="<spring:message code="puttingContract_error_msg_contractClause"/>">${puttingContract.contractClause }</textarea>
                <p class="haveTo">*</p>
            </div>
        </div>
        <div class="w-500 items clearfix showHtml">
            <div class="items col-50 clearfix">
            <!-- 创建人员 -->
                <p class="tit"><spring:message code="puttingContract_edit_creator"/></p>
                <c:choose>
                <c:when test="${puttingContract.id!=null&&puttingContract.id!=0 }">
                	<input value="${puttingContract.createBy.firstName }" disabled="disabled">
                </c:when>
                <c:otherwise>
                	<input value="${ognization.createBy.firstName }${ognization.createBy.lastName }" disabled="disabled">
                </c:otherwise>
                </c:choose>
            </div>
            <div class="items col-50 clearfix">
            <!-- 创建时间 -->
                <p class="tit"><spring:message code="puttingContract_edit_createDate"/></p>
                <c:choose>
                <c:when test="${puttingContract.id!=null&&puttingContract.id!=0 }">
                	<input value="<fmt:formatDate value="${puttingContract.createDate }" pattern="yyyy-MM-dd" />" disabled="disabled">
                </c:when>
                <c:otherwise>
                	<input value="${fns:getDate('yyyy-MM-dd')}" disabled="disabled">
                </c:otherwise>
                </c:choose>
            </div>
        </div>
	</div>
    <div class="tabSm none">
    	<div class="tableArea">
        	<div class="tableScrollSm" style="overflow: auto;width: 983px;height: 520px">
        		<table cellpadding="0" class="tableHead">
                    <thead>
                    <tr>
                    	<th class="tab-wfcz"><spring:message code="puttingContract_edit_operation"/></th>
                        <th class="tab-wfkstp"><spring:message code="puttingContract_edit_styleImage"/></th>
                        <th class="tab-wfkhksmc"><spring:message code="puttingContract_edit_styleNameNO"/></th>
                        <th class="tab-wfkslb"><spring:message code="puttingContract_edit_styleCategory"/></th>
                        <th class="tab-wfhtddh"><spring:message code="puttingContract_edit_contractNO"/></th>
                        <th class="tab-wfkh"><spring:message code="puttingContract_edit_customerName"/></th>
                        <th class="tab-wfddsl"><spring:message code="puttingContract_edit_orderQuantity"/></th>
                        <th class="tab-wfsl"><spring:message code="puttingContract_edit_puttingQuantity"/></th>
                        <th class="tab-wfjgf"><spring:message code="puttingContract_edit_cost"/></th>
                        <th class="tab-wfcjr"><spring:message code="puttingContract_edit_styleCreator"/></th>
                        <th class="tab-wfcjsj"><spring:message code="puttingContract_edit_stylecreateDate"/></th>
                    </tr>
                    </thead>
                </table>
                <table  cellpadding="0" class="tableBody" id="materialTable">
                    <tbody id="listHtml">
                    <c:forEach items="${puttingContract.styleList }" var="style" varStatus="status">
                    <tr>
                    	<td class="tab-wfcz"><img src='${ctxStatic}/images/btn-sc.png' height='30' width='30' onclick='deleteCurrentRow(this)'></td>
                        <td class="tab-wfkstp"><c:if test="${style.styleFile!=null && style.styleFile!='' }"><img src="${style.styleFile }" class="wltp"></c:if><c:if test="${style.styleFile==null||style.styleFile=='' }"><img src="${ctxStatic}/images/pic-none.jpg" class="wltp"></c:if></td>
                        <td class="tab-wfkhksmc">${style.styleCustomerNo }<br>${style.styleNameCN }</td>
                        <td class="tab-wfkslb">${fns:getDictName(style.styleCatgoryCD) }</td>
                        <td class="tab-wfhtddh">${style.customerContractNO }</td>
                        <td class="tab-wfkh">${style.styleCustomerName }</td>
                        <td class="tab-wfddsl">${style.indentQuantity}</td>
                        <td class="tab-wfsl"><input id="puttingQuantity" name="styleList[${status.index }].contractQuantity" value="${style.contractQuantity}" onchange="quantity();" style="height:65px"/></td>
                        <td class="tab-wfjgf"><input id="puttingPrice" name="styleList[${status.index }].contractProcessCost" value="${style.contractProcessCost}" onchange="amount();" style="height:65px"/></td>
                        <td class="tab-wfcjr">${style.createBy.firstName}</td>
                        <td class="tab-wfcjsj"><fmt:formatDate value="${style.createDate}" pattern="yyyy-MM-dd" /></td>
                        <input type="hidden" name="styleList[${status.index }].styleID" value="${style.styleID}"/>
                        <input type="hidden" name="styleList[${status.index }].indentID" value="${style.indentID}"/>
                        <input type="hidden" name="styleList[${status.index }].contractID" value="${style.contractID}"/>
                        <input type="hidden" class="statusIndex" value="${status.index}"/>
                    </tr>
                    </c:forEach>
                    </tbody>
                </table>
                <div id="hiddenHtml"></div>
            </div>
        </div>
    </div>
    
</div>
</form>
<script>
	window.onload = function(){
			var windowH = window.innerHeight
					||document.documentElement.clientHeight
					||document.body.clientHeight
			$('.tabSm').css({
				'height':windowH - 77,
			});
			$('.tableScrollSm').css({
				'height':windowH - 91
			})
		}
	$('.squareL').on('click', function() {
	    var lastCon = $('.square ol li:last-child').detach();
	    $('.square ol').prepend(lastCon)
	    $('.square ol li:last-child').addClass('active')
	    $('.square ol li:last-child').siblings().removeClass('active')
	})

	$('.squareR').on('click', function() {
	    var lastCon = $('.square ol li:first-child').detach();
	    $('.square ol').append(lastCon)
	    $('.square ol li:last-child').addClass('active')
	    $('.square ol li:last-child').siblings().removeClass('active')
	})
	$('.showHtml').find('input').attr('disabled','disabled');
</script>
</body>
</html>
